import React from 'react'
import NewsPublish from '../../../components/publish-manage/NewsPublish'
import usePublish from '../../../components/publish-manage/usePublish'
import { Button, Popconfirm, message } from 'antd'

export default function Published() {
    // 2 === 已下线的
    const { dataSource, handleDelete, handlePublish } = usePublish(3)
    return (
        <div>
            <NewsPublish dataSource={dataSource} button={(id) =>
                <div>
                    <Button type="primary" onClick={() => handlePublish(id)} style={{ marginRight: '15px' }}>重新发布</Button>
                    <Popconfirm
                        title="删除新闻"
                        description="是否确认删除新闻？"
                        onConfirm={() => handleDelete(id)}
                        onCancel={() => message.error('已取消')}
                        okText="确认"
                        cancelText="取消"
                    >
                        <Button danger >删除</Button>
                    </Popconfirm>
                </div>
            }>
            </NewsPublish>
        </div >
    )
}
